<div id="test">This test verifies that we can get text/html from the clipboard
during an onpaste event.  This test requires DRT.</div>

<div id="target" contenteditable onpaste="paste(event)">
Paste content in this div.
</div>
<div id="results">FAIL</div>

<script src="../editing.js"></script>
<script>
var undefined;
function removeFontName(text)
{
    if (!text)
        return text;
    return text.replace(/font-family: .+?; /g, "");
}

function paste(ev)
{
    console.log("text/plain: " + ev.clipboardData.getData("text/plain"));
    // Remove the font name because it varies depending on the platform.
    console.log("text/html: " + removeFontName(ev.clipboardData.getData("text/html")));
    if (ev.clipboardData.getData("text/html") != undefined)
        document.getElementById("results").innerHTML = "PASS";
}

function editingTest()
{
    var selection = window.getSelection();
    selection.modify("extend", "forward", "sentence");
    copyCommand();

    var elem = document.getElementById("target");
    selection.collapse(elem, 0);
    selection.modify("move", "forward", "sentence");
    pasteCommand();
}

runDumpAsTextEditingTest(false);
</script>
